#include "Singleton.h"
#include <iostream>

Singleton::Singleton() {
    std::cout << "Singleton 构造函数被调用" << std::endl;
}

Singleton& Singleton::getInstance() {
    static Singleton instance;  // C++11保证线程安全的懒汉式单例
    return instance;
}

void Singleton::doSomething() {
    std::cout << "执行某些操作..." << std::endl;
    std::cout << "当前实例地址: " << this << std::endl;
}

void Singleton::showInfo() {
    std::cout << "=== 单例模式信息 ===" << std::endl;
    std::cout << "实例地址: " << this << std::endl;
    std::cout << "这是一个线程安全的单例实现" << std::endl;
    std::cout << "===================" << std::endl;
}